/**
 * 
 */
package net.loyintean.pearlshell.logcenter.model.impl;

import net.loyintean.pearlshell.logcenter.model.ILogModel;

import org.apache.log4j.spi.LocationInfo;
import org.apache.log4j.spi.LoggingEvent;


/**
 * @author Administrator
 * 
 */
public class ILogFactory {

	public static final ILogModel build(String systemName, LoggingEvent event) {
		LogModelImpl log = new LogModelImpl();
		
		
		log.setSystermName(systemName);
		
		log.setLevel(event.getLevel().toString());
		log.setMessage(event.getMessage().toString());
		log.setThreadName(event.getThreadName());
		log.setTimeStamp(event.getTimeStamp());
		
		LocationInfo location = event.getLocationInformation();
		log.setClassName(location.getClassName());
		log.setLineNumber(location.getLineNumber());
		log.setMethodName(location.getMethodName());
		
		return log;
		
	}
}
